package sample.plugin;

import org.apache.maven.plugin.AbstractMojo;
import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugins.annotations.LifecyclePhase;
import org.apache.maven.plugins.annotations.Mojo;
import org.apache.maven.plugins.annotations.ResolutionScope;

/**
 * Says "Hi" to the user.
 * 默认是在phase为package时执行，在build中可以不配置phase如
 *    <build>
 *         <plugins>
 *             <plugin>
 *                 <groupId>sample.plugin</groupId>
 *                 <artifactId>hello-maven-plugin</artifactId>
 *                 <version>1.0-SNAPSHOT</version>
 *                 <executions>
 *                     <execution>
 *                         <goals>
 *
 *                             <goal>sayhi</goal>
 *                         </goals>
 *                     </execution>
 *                 </executions>
 *             </plugin>
 *         </plugins>
 *     </build>
 * 若在build中配置了phase，将会覆盖defaultPhase即在默认的phase时不会执行
 *   <build>
 *         <plugins>
 *             <plugin>
 *                 <groupId>sample.plugin</groupId>
 *                 <artifactId>hello-maven-plugin</artifactId>
 *                 <version>1.0-SNAPSHOT</version>
 *                 <executions>
 *                     <execution>
 *                         <phase>clean</phase>
 *                         <goals>
 *
 *                             <goal>sayhi</goal>
 *                         </goals>
 *                     </execution>
 *                 </executions>
 *             </plugin>
 *         </plugins>
 *     </build>
 */
@Mojo( name = "sayhi",defaultPhase = LifecyclePhase.PACKAGE,threadSafe = true, requiresDependencyResolution = ResolutionScope.RUNTIME)
public class GreetingMojo extends AbstractMojo
{

    public void execute() throws MojoExecutionException
    {
        getLog().info( "*****能显示中文****" );
    }
}
